from comms.seafile_func import login, seafile_user_info, seafile_add_zlk, seafile_zlk_select, seafile_zlk_modify, \
    seafile_zlk_delete, sea_file_new_file, sea_file_delete_file
from comms.tools import get_str_by_re

# login()
# print('*'*100)
# login('','admin')
# print('*'*100)
# login('seafile@admin.com','')
# resp=login()
# print('*'*100)
# resp=seafile_user_info()
# token=eval(resp.text)['token']
# seafile_user_info(token)
# login()
print('1.登录鉴权')
reap1=login()
token=eval(reap1.text)['token']
# assert 'application/json'==reap1.headers.get('Content-Type')
# assert reap1.status_code==200
# assert 'token' in reap1.text
# assert  reap1.elapsed.total_seconds()<0.05
print('*'*100)

# seafile_user_info(token)
print('2.获取信息')
reap2=seafile_user_info(token)
# assert 'application/json'==reap2.headers.get('Content-Type')
# assert reap2.status_code==200
# assert  reap2.elapsed.total_seconds()<0.05
# assert 'email' in reap2.text
print('---'*100)
print('3.新增资料库接口')
reap3=seafile_add_zlk(token,'勾八129')
repo_id=get_str_by_re('repo_id":"','"',reap3.text)
print('---'*100)
print('4.查询所有的资料库接口')
reap4=seafile_zlk_select(token)
print('---'*100)
print('5.修改资料库名称')
reap5=seafile_zlk_modify(repo_id,token,'勾七129')
print('---'*100)
print('7.在指定的资料库目录新建文件接口')
reap7=sea_file_new_file(repo_id,'129.txt',token)
print('---'*100)
print('8.在指定的资料库目录删除文件接口')
reap8=sea_file_delete_file(repo_id,'129.txt',token)
print('---'*100)
print('6.删除指定的资料库接口')
reap6=seafile_zlk_delete(repo_id,token)




